<?php
/****系统值****/
// error_reporting(E_ALL); 
// ini_set('display_errors', '1');
header('Content-type:text/html;charset=utf-8');
date_default_timezone_set('Asia/Shanghai');

// require_once('/www/htdocs/appkfsy/autocode/ah.php');
function httpPost($url,$data){
	$data['sign'] = sign($data);
	$headers[] = "Content-type:application/json;";
	$data = json_encode($data);
	$ch = curl_init ();
	curl_setopt ( $ch, CURLOPT_URL, $url );
	curl_setopt ( $ch, CURLOPT_POST, 1 );
	curl_setopt ( $ch, CURLOPT_HEADER, 0 );
	curl_setopt ( $ch, CURLOPT_HTTPHEADER, $headers);
	curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, false);
	curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
	curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data );
	$result = curl_exec ( $ch );
	$err = curl_error($ch);
	curl_close ( $ch );
	if($err){
		return $err;
	}else{
		return $result;
	}
}
//计算签名
function sign($data){
	ksort($data);
	foreach($data as $k => $v){
		@$apost .= (isset($apost)?"&":'')."{$k}={$v}";
	}
	$apost .= "&key=123456";
	$apost = strtoupper(md5($apost));
	return $apost;
}
